<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="author" content="VectorX">
    <meta name="keywords" content="过渡">
    <title>过渡</title>
    <style>
        .box1 {
            height: 500px;
            width: 1000px;
            background-color: #bfa;
        }

        .box2 {
            height: 100px;
            width: 100px;
            background-color: red;
            margin-left: 500px;

            /* animation-name: test;
            animation-duration: 2s;
            animation-delay: 2s;
            animation-timing-function: linear;
            animation-iteration-count: infinite;
            animation-direction: alternate;
            animation-fill-mode: both; */

            animation: test 2s 2s linear infinite alternate both;
        }


        @keyframes test {
            from {
                margin-left: 0;
            }

            to {
                margin-left: 900px;
            }
        }
    </style>
</head>

<body>
    <div class="box1">
        <div class="box2"></div>
    </div>
</body>

</html>